class Solution:
    def issum(self,nums:List[int]) -> list:
        lens=len(nums)
        ans=[]
        if lens==1:
            return nums
        for i in range(lens-1):
            newx=(nums[i]+nums[i+1])%10
            ans.append(newx)
        return self.issum(ans)


    def triangularSum(self, nums: List[int]) -> int:
        ans=self.issum(nums)
        return ans[0]
